
<template>
  <ex_super_input :value="value" type='select' :url="urlUse" storeData filterable :clearable="clearable"
    :option="optionBuild" v-bind="$attrs" v-on="$listeners" />
</template>


<script>
import role_system_mixin from '@/mixin/role_system_mixin';

export default {
  name: 'country_select',
  mixins: [role_system_mixin,],

  props: {
    value: {
      type: String,
      default: null,
    },
    clearable: {
      type: Boolean,
      default: false,
    },
    optionValue: {
      type: String,
      default: 'countryCode',
    },
    url: {
      type: String,
      default: null,
    }
  },
  data() {
    return {
      urlUse: this.url
    }
  },
  created() {
    if (!this.urlUse) {
      console.log(this)
      if (this.isCustomerSystem) {
        this.urlUse = "/tms-api/client/TmsPlaceInfoClientRpc/selectCountry.json"
      } else {
        this.urlUse = "/tms-api/base/TmsPlaceInfoRpc/selectCountry.json"
      }
    }

  },
  methods: {
    optionBuild(it) {
      return { label: this.$formatNameCode(it.countryName, it.countryCode), value: it[this.optionValue] }
    },
  },
}
</script>
